<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
    x:Class="OpenLS.UI.Internals.HeaderPresenterControlResources"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Internals="clr-namespace:OpenLS.UI.Internals"
    xmlns:Themes="clr-namespace:OpenLS.UI.Themes"
    xmlns:UI="clr-namespace:OpenLS.UI">
    <ResourceDictionary.MergedDictionaries>
        <Themes:ContentPresenterResources />
    </ResourceDictionary.MergedDictionaries>
    <Style TargetType="{x:Type Rectangle}" x:Key="DebugRect">
        <Setter Property="Width" Value="10"/>
        <Setter Property="Height" Value="5"/>
        <Setter Property="Fill" Value="Gray"/>
        <Setter Property="Visibility" Value="Collapsed"/>
    </Style>
    <Geometry x:Key="downArrowGeometry">M 0 0 L 2.5 3 L 5 0 Z</Geometry>





    <ControlTemplate x:Key="template2" TargetType="{x:Type Internals:HeaderPresenterControl}">
        <Grid>
            <Rectangle  x:Name="lightRect"  Fill="{DynamicResource {x:Static UI:OfficeBrushes.ApplicationMenuButtonPressedBackgroundKey}}" Visibility="Hidden"/>
            <DockPanel x:Name="ContentPanel" Margin="{TemplateBinding Padding}" >
                <ContentPresenter x:Name="Icon" Style="{StaticResource ContentPresenterType}" 
                            ContentSource="Icon" 
                            DockPanel.Dock="Top" MaxHeight="{DynamicResource {x:Static UI:Sizes.LargeHeightKey}}" MaxWidth="{DynamicResource {x:Static UI:Sizes.LargeWidthKey}}" Margin="0"  />
                <Border x:Name="CheckMark" Margin="0" Visibility="Collapsed" VerticalAlignment="Bottom"  Background="{TemplateBinding Foreground}" CornerRadius="1" Width="6" Height="6" />
                <UI:TwoLineControl x:Name="HeaderHost" HorizontalAlignment ="Center" Content="{TemplateBinding Header}">
                    <UI:TwoLineControl.Symbol>
                        <Path Data="{StaticResource downArrowGeometry}" Margin="0" Fill ="{DynamicResource {x:Static UI:OfficeBrushes.TextForegroundKey}}"
                HorizontalAlignment="Center" DockPanel.Dock="Bottom" Name="Arrow" VerticalAlignment="Center"/>
                    </UI:TwoLineControl.Symbol>
                </UI:TwoLineControl>
                <Rectangle Style="{StaticResource DebugRect}" Fill="DarkGoldenrod"/>

                <Rectangle Style="{StaticResource DebugRect}" Fill="{TemplateBinding TextElement.Foreground}"/>
            </DockPanel>

        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="CheckMark" Property="Visibility" Value="Visible" />
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsOpen" Value="True">
                <Setter Property="Visibility" Value="Visible" TargetName="lightRect"/>
            </Trigger>
            <Trigger Property="UI:RibbonElement.ControlState" Value="Large">
                <Setter Property="UsesTwoLines" Value="True" TargetName="HeaderHost"/>

            </Trigger>
            <Trigger Property="UI:RibbonElement.ControlState" Value="Medium">
                <Setter Property="Margin" Value="1 0 1 0" TargetName ="Icon"/>
                <Setter Property="MaxWidth" Value="{DynamicResource {x:Static UI:Sizes.MediumWidthKey}}" TargetName ="Icon"/>
                <Setter Property="MaxHeight" Value="{DynamicResource {x:Static UI:Sizes.MediumHeightKey}}" TargetName ="Icon"/>
                <Setter Property="DockPanel.Dock" Value="Left" TargetName="Icon"/>
                <Setter Property="DockPanel.Dock" Value="Right" TargetName="Arrow"/>
                <Setter Property="Padding" Value="1"/>
            </Trigger>
            <Trigger Property="UI:RibbonElement.ControlState" Value="Small">
                <Setter Property="Visibility" Value="Collapsed" TargetName ="HeaderHost"/>
                <Setter Property="Margin" Value="1 0 1 0" TargetName ="Icon"/>
                <Setter Property="MaxWidth" Value="{DynamicResource {x:Static UI:Sizes.SmallWidthKey}}" TargetName ="Icon"/>
                <Setter Property="MaxHeight" Value="{DynamicResource {x:Static UI:Sizes.SmallHeightKey}}" TargetName ="Icon"/>
                <Setter Property="DockPanel.Dock" Value="Left" TargetName="Icon"/>
                <Setter Property="DockPanel.Dock" Value="Right" TargetName="Arrow"/>
                <Setter Property="Padding" Value="1"/>
            </Trigger>

        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate TargetType="{x:Type Internals:HeaderPresenterControl}" x:Key="smallHeaderTemplate">
        <DockPanel >
            <ContentPresenter Style="{StaticResource ContentPresenterType}" x:Name="IconHost" Margin="2" VerticalAlignment="Stretch"  HorizontalAlignment="Right" ContentSource="Icon" DockPanel.Dock="Left"
                              MaxHeight="{DynamicResource {x:Static UI:Sizes.SmallHeightKey}}"
                              MaxWidth="{DynamicResource {x:Static UI:Sizes.SmallWidthKey}}"
                              />
            <Border x:Name="CheckMark" Margin="2" Visibility="Collapsed" VerticalAlignment="Stretch" Background="{TemplateBinding Foreground}" CornerRadius="1" Width="6" Height="6" />
            <Path x:Name="Arrow" Margin="2" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}"
                  Data="{StaticResource downArrowGeometry}" DockPanel.Dock="Right"/>
            <ContentPresenter x:Name="HeaderHost" RecognizesAccessKey="True" ContentSource="Header" Margin="{TemplateBinding Padding}" DockPanel.Dock="Right"/>
        </DockPanel>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="IconHost" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="CheckMark" Property="Visibility" Value="Visible" />
                <Setter TargetName="IconHost" Property="Visibility" Value="Collapsed" />
            </Trigger>

        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style TargetType="{x:Type Internals:HeaderPresenterControl}">
        <Setter Property="Template" Value="{StaticResource smallHeaderTemplate}">
        </Setter>
        <Style.Triggers>
            <Trigger Property="Tag" Value="2">
                <Setter Property="Template"  Value="{StaticResource template2}"></Setter>
            </Trigger>
        </Style.Triggers>
    </Style>


</ResourceDictionary>